package com.neouton.crm.screen.controller;

import com.neouton.common.util.ResponseAPI;
import com.neouton.crm.screen.entity.ScreenVO;
import com.neouton.crm.screen.service.IScreenService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * CRM系统统计类controller
 */
@RestController
@RequestMapping("screen")
public class ScreenController {
    @Resource
    private IScreenService screenService;

    /**
     * 获取总览数据
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/queryAllByProjectId/{projectId}")
    public ResponseAPI queryAllByProjectId(@PathVariable(value = "projectId") Integer projectId) {
        Map<String, BigDecimal> res = screenService.queryAllByProjectId(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryPurByProjectIdGroupSupper/{projectId}")
    public ResponseAPI queryPurByProjectIdGroupSupper(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryPurByProjectIdGroupSupper(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryPurDataByProjectId/{projectId}")
    public ResponseAPI queryPurDataByProjectId(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryPurDataByProjectId(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryPayData/{projectId}")
    public ResponseAPI queryPayData(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryPayData(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryNoPayData/{projectId}")
    public ResponseAPI queryNoPayData(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryNoPayData(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryReceiptRecordData/{projectId}")
    public ResponseAPI queryReceiptRecordData(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryReceiptRecordData(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 查询各供应商采购数据统计
     * @param projectId
     * @return
     */
    @PostMapping("/queryReceiptRecordDataByUser/{projectId}")
    public ResponseAPI queryReceiptRecordDataByUser(@PathVariable(value = "projectId") Integer projectId){
        Map<String, BigDecimal> res = screenService.queryReceiptRecordDataByUser(projectId);
        return ResponseAPI.successData(res);
    }



    /**
     * 获取合同金额与项目金额差距数据
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/getContractInfo/{projectId}")
    public ResponseAPI getContractInfo(@PathVariable(value = "projectId") Integer projectId) {
        List<ScreenVO> res = screenService.getContractInfo(projectId);
        return ResponseAPI.successData(res);
    }


    /**
     * 获取客户合同信息
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/getContractInfoByCustomer/{projectId}")
    public ResponseAPI getContractInfoByCustomer(@PathVariable(value = "projectId") Integer projectId) {
        List<ScreenVO> res = screenService.getContractInfoByCustomer(projectId);
        return ResponseAPI.successData(res);
    }

    /**
     * 获取个人报销明细
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/getReimbursementInfo/{projectId}")
    public ResponseAPI getReimbursementInfo(@PathVariable(value = "projectId") Integer projectId) {
        List<ScreenVO> res = screenService.getReimbursementInfo(projectId);
        return ResponseAPI.successData(res);
    }


    /**
     * 获取回款信息明细
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/getRecordInfo/{projectId}")
    public ResponseAPI getRecordInfo(@PathVariable(value = "projectId") Integer projectId) {
        List<ScreenVO> res = screenService.getRecordInfo(projectId);
        return ResponseAPI.successData(res);
    }


    /**
     * 获取未回款明细
     * @param projectId 项目ID
     * @return
     */
    @PostMapping("/getNotBackRecordInfo/{projectId}")
    public ResponseAPI getNotBackRecordInfo(@PathVariable(value = "projectId") Integer projectId) {
        List<ScreenVO> res = screenService.getNotBackRecordInfo(projectId);
        return ResponseAPI.successData(res);
    }
}
